﻿@model IEnumerable<VehicleManagement.Models.BreakRules>
@{
    ViewBag.Title = "Index";
}

@*<h2>Index</h2>*@
@*<script type="text/javascript">
    $(function () {
        $.post("/BreakRules/GetPagingInfo", {},
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text(data.CurrentPage);
            });
    });
</script>*@
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(function () {

        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("CarNumber") != "" && !$.query.get("CarNumber")) {
            $("input[name='CarNumber']").val($.query.get("CarNumber"));
        }

        if ($.query.get("DriverName") != "" && !$.query.get("DriverName")) {
            $("input[name='DriverName']").val($.query.get("DriverName"));
        }

        if ($.query.get("BreakRules") != "" && !$.query.get("BreakRules")) {
            $("input[name='BreakRules']").val($.query.get("BreakRules"));
        }

        $.get("/BreakRules/GetPagingInfo",
            {
                CarNumber: $("input[name='CarNumber']").val(),
                DriverName: $("input[name='DriverName']").val(),
                BreakRules: $("input[name='BreakRules']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
    function DeleteAddGas(id) {
        if (confirm("你确认删除这条加油信息吗?")) {
            $.post("/AddGas/DeleteAddGas", "id=" + id, function (ret) {
                if (ret.Result == "true") {
                    alert(ret.Message);
                    window.location.reload();
                }
                else {
                    alert(ret.Message);
                }
            }, "json");
        }
    }
</script>
<div class="mas">
    <div class="toptitle">
        司机负责人管理平台
    </div>
    @*<div class="car"></div>*@
    @Html.Partial("_PartviewDriverManager")
    <div class="rightshow">
        <div class="classifyinfo">
            <div class="system-location">
                <a>司机负责人管理系统</a>>><a>事故违章</a>
            </div>
            <div class="system-Userinfo">
                <span class="space">当前用户:</span><a>张测试</a><span class="space">部门:</span><a>技术部</a><a
                    class="space">退出</a>
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="apply_content">
            <div class="contrlcar">
            </div>
            <div class="createrecord">
                <div class="createrecord_bc">
                    <div class="createrecord_bc1">@Html.ActionLink("添加新记录", "Create")</div>
                </div>
            </div>
            <div class="apply_cn1">
                @using (Html.BeginForm("Index", "BreakRules", FormMethod.Get, new { id = "SearchForm" }))
                {
                    @Html.Hidden("Page");
                <div class="apply_cn1-item">
                    记录筛选：
                </div>
                <div class="apply_cn1-item1">
                    @*<select id="sort-bar-itemSelect1" name="车辆类型">
                        <option>司机名</option>
                        <option></option>
                        <option>轿车</option>
                    </select>*@
                    <input type="text" name="CarNumber" value="车牌号" />
                </div>
                <div class="apply_cn1-item1">
                  @*<select id="sort-bar-itemSelect2">
                        <option>发生日期</option>
                    </select>*@
                    <input type="text" name="DriverName" value="司机姓名" />
                </div>
                <div class="apply_cn1-item1">
                      @*<select id="sort-bar-itemSelect3">
                        <option>车辆编码</option>
                        <option>已审批</option>
                    </select>*@
                    <input type="text" name="BreakRules" value="违章行为" />
                </div>
                <div class="apply_cn1-item2">
                    <input id="Text3" name="key" type="text" value="模糊查找" class="apply_cn1-item2_itp1" />
                </div>
                    <input type="submit" value="查找" class="apply_cn1-item2_btn1" />
                }
                <div class="clear">
                </div>
            </div>
        </div>

        <table id="applytable" cellspacing="0">
            <tr>
                <th>
                    车牌号
                </th>
                <th>
                    司机姓名
                </th>
                <th>
                    发生日期
                </th>
                <th>
                    事故地点
                </th>
                <th>
                    出车事由
                </th>
                <th>
                    编辑
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.CarNumber)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DriverName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Date)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Location)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Reason)
                    </td>
                    <td id="myapplytabletd">
                        <div class="myapplytable_dt">
                            @Html.ActionLink("修改", "Edit", new { id = item.BreakRulesID })
                        </div>
                        <div class="myapplytable_dt">
                            @Html.ActionLink("详细", "Details", new { id = item.BreakRulesID })
                        </div>
                        <div class="myapplytable_dt">
                            @*@Html.ActionLink("删除", "Delete", new { id=item.BreakRulesID })*@
                              <a class="RemoveLink" href="javascript:void(0)" onclick="DeleteBreakRules(@item.BreakRulesID)">删除</a>
                        </div>
                    </td>
                </tr>
            }
        </table>
        <div>
    共<span id="TotalItems"></span>条记录， 每页显示<span id="ItemsPerPage"></span>条， 共<span id="TotalPages"></span>页，
    当前第<span id="CurrentPage"></span>页 <a id="FirstPage" href="javascript:void(0)">首页</a>
    <a id="PrevPage" href="javascript:void(0)">上一页</a> <a id="NextPage" href="javascript:void(0)">
        下一页</a> <a id="LastPage" href="javascript:void(0)">末页</a> <span>跳转到</span>
    <input type="text" id="PageToGo" />
    <input type="button" id="GoToPage" value="Go" />
</div>
    </div>
    <div class="clear">
        
    </div>
</div>
